package com.runner.boost;

import java.util.ArrayList;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.runner.player.Player;
import com.runner.track.Coin;

public class MagnetBoost implements Boost {

	
	private Player player;
	private final ArrayList<Coin> coins;

	public MagnetBoost(Player p, final ArrayList<Coin> coins) {
		player = p;
		this.coins = coins;
	}

	@Override
	public void activate() {

	}

	@Override
	public void update(float delta) {
		for (Coin c : coins) {
			if (player.getPhysics().getBody().getPosition().dst(c.getPhysics().getBody().getPosition()) < 2) {
				followPlayer(c);
			}
		}
	}

	private void followPlayer(Coin c) {
		c.followPlayer(player);
	}

	@Override
	public void render(SpriteBatch sb) {
		// TODO Auto-generated method stub

	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isExists() {
		// TODO Auto-generated method stub
		return true;
	}

}
